package bishi;

/**
 * @Author liuhaoqi
 * @Date 2020/8/29 15:13
 * @Version 1.0
 */
public class HikVisionTestStringIndexOf {
    public static void main(String[] args) {
        String str = "Hello Wrold, Hello China, Hello Beijing.";
        int index = str.indexOf("China");
        if (index == -1) {
            System.out.println("查找的字符不存在");
        } else {
            System.out.println("index的值位： " + index);
        }
    }
    public String reverseWords(String s) {
        String[] chars = s.split(" ");
        StringBuffer sb = new StringBuffer();
        for(int i=0;i<chars.length;i++){
            for (int j = chars[i].length() - 1; j >= 0; j--) {
                sb.append(chars[j]);
            }
            sb.append(" ");
        }
        sb.deleteCharAt(sb.length() - 1);
        String str = new String(sb);
        return str;
    }
}
